
/*
===============================================================================
                    EntitySpaces Studio by EntitySpaces, LLC
             Persistence Layer and Business Objects for Microsoft .NET
             EntitySpaces(TM) is a legal trademark of EntitySpaces, LLC
                          http://www.entityspaces.net
===============================================================================
EntitySpaces Version : 2012.1.0930.0
EntitySpaces Driver  : SQL
Date Generated       : 2016/10/31 16:01:02
===============================================================================
*/

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Linq;
using System.Data;
using System.ComponentModel;
using System.Xml.Serialization;
using System.Runtime.Serialization;

using EntitySpaces.Core;
using EntitySpaces.Interfaces;
using EntitySpaces.DynamicQuery;



namespace yncTech.BusinessObjects
{
	/// <summary>
	/// Encapsulates the 'Fin_Lend' table
	/// </summary>

    [DebuggerDisplay("Data = {Debug}")]
	[Serializable]
	[DataContract]
	[KnownType(typeof(FinLend))]	
	[XmlType("FinLend")]
	public partial class FinLend : esFinLend
	{	
		[DebuggerBrowsable(DebuggerBrowsableState.RootHidden | DebuggerBrowsableState.Never)]
		protected override esEntityDebuggerView[] Debug
		{
			get { return base.Debug; }
		}

		override public esEntity CreateInstance()
		{
			return new FinLend();
		}
		
		#region Static Quick Access Methods
		static public void Delete(System.Decimal lendID)
		{
			var obj = new FinLend();
			obj.LendID = lendID;
			obj.AcceptChanges();
			obj.MarkAsDeleted();
			obj.Save();
		}

	    static public void Delete(System.Decimal lendID, esSqlAccessType sqlAccessType)
		{
			var obj = new FinLend();
			obj.LendID = lendID;
			obj.AcceptChanges();
			obj.MarkAsDeleted();
			obj.Save(sqlAccessType);
		}
		#endregion

		
					
		
	
	}



    [DebuggerDisplay("Count = {Count}")]
	[Serializable]
	[CollectionDataContract]
	[XmlType("FinLendCollection")]
	public partial class FinLendCollection : esFinLendCollection, IEnumerable<FinLend>
	{
		public FinLend FindByPrimaryKey(System.Decimal lendID)
		{
			return this.SingleOrDefault(e => e.LendID == lendID);
		}

		
		
		#region WCF Service Class
		
		[DataContract]
		[KnownType(typeof(FinLend))]
		public class FinLendCollectionWCFPacket : esCollectionWCFPacket<FinLendCollection>
		{
			public static implicit operator FinLendCollection(FinLendCollectionWCFPacket packet)
			{
				return packet.Collection;
			}

			public static implicit operator FinLendCollectionWCFPacket(FinLendCollection collection)
			{
				return new FinLendCollectionWCFPacket() { Collection = collection };
			}
		}
		
		#endregion
		
				
	}



    [DebuggerDisplay("Query = {Parse()}")]
	[Serializable]	
	public partial class FinLendQuery : esFinLendQuery
	{
        public FinLendQuery() : this("FinLendQuery")
		{
		}
		public FinLendQuery(string joinAlias)
		{
			this.es.JoinAlias = joinAlias;
		}	

		override protected string GetQueryName()
		{
			return "FinLendQuery";
		}
		
					
	
		#region Explicit Casts
		
		public static explicit operator string(FinLendQuery query)
		{
			return FinLendQuery.SerializeHelper.ToXml(query);
		}

		public static explicit operator FinLendQuery(string query)
		{
			return (FinLendQuery)FinLendQuery.SerializeHelper.FromXml(query, typeof(FinLendQuery));
		}
		
		#endregion		
	}

	[DataContract]
	[Serializable]
	abstract public partial class esFinLend : esEntity
	{
		public esFinLend()
		{

		}
		
		#region LoadByPrimaryKey
		public virtual bool LoadByPrimaryKey(System.Decimal lendID)
		{
			if(this.es.Connection.SqlAccessType == esSqlAccessType.DynamicSQL)
				return LoadByPrimaryKeyDynamic(lendID);
			else
				return LoadByPrimaryKeyStoredProcedure(lendID);
		}

		public virtual bool LoadByPrimaryKey(esSqlAccessType sqlAccessType, System.Decimal lendID)
		{
			if (sqlAccessType == esSqlAccessType.DynamicSQL)
				return LoadByPrimaryKeyDynamic(lendID);
			else
				return LoadByPrimaryKeyStoredProcedure(lendID);
		}

		private bool LoadByPrimaryKeyDynamic(System.Decimal lendID)
		{
			FinLendQuery query = new FinLendQuery();
			query.Where(query.LendID == lendID);
			return this.Load(query);
		}

		private bool LoadByPrimaryKeyStoredProcedure(System.Decimal lendID)
		{
			esParameters parms = new esParameters();
			parms.Add("LendID", lendID);
			return this.Load(esQueryType.StoredProcedure, this.es.spLoadByPrimaryKey, parms);
		}
		#endregion
		
		#region Properties
		
		
		
		/// <summary>
		/// Maps to Fin_Lend.LendID
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.Decimal? LendID
		{
			get
			{
				return base.GetSystemDecimal(FinLendMetadata.ColumnNames.LendID);
			}
			
			set
			{
				if(base.SetSystemDecimal(FinLendMetadata.ColumnNames.LendID, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.LendID);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.SN
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String Sn
		{
			get
			{
				return base.GetSystemString(FinLendMetadata.ColumnNames.Sn);
			}
			
			set
			{
				if(base.SetSystemString(FinLendMetadata.ColumnNames.Sn, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.Sn);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.LendType
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String LendType
		{
			get
			{
				return base.GetSystemString(FinLendMetadata.ColumnNames.LendType);
			}
			
			set
			{
				if(base.SetSystemString(FinLendMetadata.ColumnNames.LendType, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.LendType);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.LendDate
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.DateTime? LendDate
		{
			get
			{
				return base.GetSystemDateTime(FinLendMetadata.ColumnNames.LendDate);
			}
			
			set
			{
				if(base.SetSystemDateTime(FinLendMetadata.ColumnNames.LendDate, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.LendDate);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.Loanee
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String Loanee
		{
			get
			{
				return base.GetSystemString(FinLendMetadata.ColumnNames.Loanee);
			}
			
			set
			{
				if(base.SetSystemString(FinLendMetadata.ColumnNames.Loanee, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.Loanee);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.ReturnDate
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.DateTime? ReturnDate
		{
			get
			{
				return base.GetSystemDateTime(FinLendMetadata.ColumnNames.ReturnDate);
			}
			
			set
			{
				if(base.SetSystemDateTime(FinLendMetadata.ColumnNames.ReturnDate, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.ReturnDate);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.LoaneeEmail
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String LoaneeEmail
		{
			get
			{
				return base.GetSystemString(FinLendMetadata.ColumnNames.LoaneeEmail);
			}
			
			set
			{
				if(base.SetSystemString(FinLendMetadata.ColumnNames.LoaneeEmail, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.LoaneeEmail);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.ActReturnDate
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.DateTime? ActReturnDate
		{
			get
			{
				return base.GetSystemDateTime(FinLendMetadata.ColumnNames.ActReturnDate);
			}
			
			set
			{
				if(base.SetSystemDateTime(FinLendMetadata.ColumnNames.ActReturnDate, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.ActReturnDate);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.Attachment
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String Attachment
		{
			get
			{
				return base.GetSystemString(FinLendMetadata.ColumnNames.Attachment);
			}
			
			set
			{
				if(base.SetSystemString(FinLendMetadata.ColumnNames.Attachment, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.Attachment);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.Comments
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String Comments
		{
			get
			{
				return base.GetSystemString(FinLendMetadata.ColumnNames.Comments);
			}
			
			set
			{
				if(base.SetSystemString(FinLendMetadata.ColumnNames.Comments, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.Comments);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.CreatedBy
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String CreatedBy
		{
			get
			{
				return base.GetSystemString(FinLendMetadata.ColumnNames.CreatedBy);
			}
			
			set
			{
				if(base.SetSystemString(FinLendMetadata.ColumnNames.CreatedBy, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.CreatedBy);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.CreatedDttm
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.DateTime? CreatedDttm
		{
			get
			{
				return base.GetSystemDateTime(FinLendMetadata.ColumnNames.CreatedDttm);
			}
			
			set
			{
				if(base.SetSystemDateTime(FinLendMetadata.ColumnNames.CreatedDttm, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.CreatedDttm);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.UpdatedBy
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String UpdatedBy
		{
			get
			{
				return base.GetSystemString(FinLendMetadata.ColumnNames.UpdatedBy);
			}
			
			set
			{
				if(base.SetSystemString(FinLendMetadata.ColumnNames.UpdatedBy, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.UpdatedBy);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.UpdatedDttm
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.DateTime? UpdatedDttm
		{
			get
			{
				return base.GetSystemDateTime(FinLendMetadata.ColumnNames.UpdatedDttm);
			}
			
			set
			{
				if(base.SetSystemDateTime(FinLendMetadata.ColumnNames.UpdatedDttm, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.UpdatedDttm);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.LendStatus
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String LendStatus
		{
			get
			{
				return base.GetSystemString(FinLendMetadata.ColumnNames.LendStatus);
			}
			
			set
			{
				if(base.SetSystemString(FinLendMetadata.ColumnNames.LendStatus, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.LendStatus);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.LoaneePhone
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String LoaneePhone
		{
			get
			{
				return base.GetSystemString(FinLendMetadata.ColumnNames.LoaneePhone);
			}
			
			set
			{
				if(base.SetSystemString(FinLendMetadata.ColumnNames.LoaneePhone, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.LoaneePhone);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.Leader
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String Leader
		{
			get
			{
				return base.GetSystemString(FinLendMetadata.ColumnNames.Leader);
			}
			
			set
			{
				if(base.SetSystemString(FinLendMetadata.ColumnNames.Leader, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.Leader);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.LeaderEmail
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String LeaderEmail
		{
			get
			{
				return base.GetSystemString(FinLendMetadata.ColumnNames.LeaderEmail);
			}
			
			set
			{
				if(base.SetSystemString(FinLendMetadata.ColumnNames.LeaderEmail, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.LeaderEmail);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.ApplyDate
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.DateTime? ApplyDate
		{
			get
			{
				return base.GetSystemDateTime(FinLendMetadata.ColumnNames.ApplyDate);
			}
			
			set
			{
				if(base.SetSystemDateTime(FinLendMetadata.ColumnNames.ApplyDate, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.ApplyDate);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.ActLendDate
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.DateTime? ActLendDate
		{
			get
			{
				return base.GetSystemDateTime(FinLendMetadata.ColumnNames.ActLendDate);
			}
			
			set
			{
				if(base.SetSystemDateTime(FinLendMetadata.ColumnNames.ActLendDate, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.ActLendDate);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.IsKey
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.Boolean? IsKey
		{
			get
			{
				return base.GetSystemBoolean(FinLendMetadata.ColumnNames.IsKey);
			}
			
			set
			{
				if(base.SetSystemBoolean(FinLendMetadata.ColumnNames.IsKey, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.IsKey);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.KeyChecker
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String KeyChecker
		{
			get
			{
				return base.GetSystemString(FinLendMetadata.ColumnNames.KeyChecker);
			}
			
			set
			{
				if(base.SetSystemString(FinLendMetadata.ColumnNames.KeyChecker, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.KeyChecker);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.KeyCeckDate
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.DateTime? KeyCeckDate
		{
			get
			{
				return base.GetSystemDateTime(FinLendMetadata.ColumnNames.KeyCeckDate);
			}
			
			set
			{
				if(base.SetSystemDateTime(FinLendMetadata.ColumnNames.KeyCeckDate, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.KeyCeckDate);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.Checker
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String Checker
		{
			get
			{
				return base.GetSystemString(FinLendMetadata.ColumnNames.Checker);
			}
			
			set
			{
				if(base.SetSystemString(FinLendMetadata.ColumnNames.Checker, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.Checker);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.CheckDate
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.DateTime? CheckDate
		{
			get
			{
				return base.GetSystemDateTime(FinLendMetadata.ColumnNames.CheckDate);
			}
			
			set
			{
				if(base.SetSystemDateTime(FinLendMetadata.ColumnNames.CheckDate, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.CheckDate);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.FinChecker
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String FinChecker
		{
			get
			{
				return base.GetSystemString(FinLendMetadata.ColumnNames.FinChecker);
			}
			
			set
			{
				if(base.SetSystemString(FinLendMetadata.ColumnNames.FinChecker, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.FinChecker);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.FinCheckDate
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.DateTime? FinCheckDate
		{
			get
			{
				return base.GetSystemDateTime(FinLendMetadata.ColumnNames.FinCheckDate);
			}
			
			set
			{
				if(base.SetSystemDateTime(FinLendMetadata.ColumnNames.FinCheckDate, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.FinCheckDate);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.CompanyName
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String CompanyName
		{
			get
			{
				return base.GetSystemString(FinLendMetadata.ColumnNames.CompanyName);
			}
			
			set
			{
				if(base.SetSystemString(FinLendMetadata.ColumnNames.CompanyName, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.CompanyName);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.ThirdUnitID
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.Decimal? ThirdUnitID
		{
			get
			{
				return base.GetSystemDecimal(FinLendMetadata.ColumnNames.ThirdUnitID);
			}
			
			set
			{
				if(base.SetSystemDecimal(FinLendMetadata.ColumnNames.ThirdUnitID, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.ThirdUnitID);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.LoaneeDepartment
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String LoaneeDepartment
		{
			get
			{
				return base.GetSystemString(FinLendMetadata.ColumnNames.LoaneeDepartment);
			}
			
			set
			{
				if(base.SetSystemString(FinLendMetadata.ColumnNames.LoaneeDepartment, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.LoaneeDepartment);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.ApplyDateEnd
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.DateTime? ApplyDateEnd
		{
			get
			{
				return base.GetSystemDateTime(FinLendMetadata.ColumnNames.ApplyDateEnd);
			}
			
			set
			{
				if(base.SetSystemDateTime(FinLendMetadata.ColumnNames.ApplyDateEnd, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.ApplyDateEnd);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.presentStartTime
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.DateTime? PresentStartTime
		{
			get
			{
				return base.GetSystemDateTime(FinLendMetadata.ColumnNames.PresentStartTime);
			}
			
			set
			{
				if(base.SetSystemDateTime(FinLendMetadata.ColumnNames.PresentStartTime, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.PresentStartTime);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.presentEndTime
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.DateTime? PresentEndTime
		{
			get
			{
				return base.GetSystemDateTime(FinLendMetadata.ColumnNames.PresentEndTime);
			}
			
			set
			{
				if(base.SetSystemDateTime(FinLendMetadata.ColumnNames.PresentEndTime, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.PresentEndTime);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.approver
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String Approver
		{
			get
			{
				return base.GetSystemString(FinLendMetadata.ColumnNames.Approver);
			}
			
			set
			{
				if(base.SetSystemString(FinLendMetadata.ColumnNames.Approver, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.Approver);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Fin_Lend.approveEmail
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String ApproveEmail
		{
			get
			{
				return base.GetSystemString(FinLendMetadata.ColumnNames.ApproveEmail);
			}
			
			set
			{
				if(base.SetSystemString(FinLendMetadata.ColumnNames.ApproveEmail, value))
				{
					OnPropertyChanged(FinLendMetadata.PropertyNames.ApproveEmail);
				}
			}
		}		
		
		#endregion	

		#region .str() Properties
		
		public override void SetProperties(IDictionary values)
		{
			foreach (string propertyName in values.Keys)
			{
				this.SetProperty(propertyName, values[propertyName]);
			}
		}
		
		public override void SetProperty(string name, object value)
		{
			esColumnMetadata col = this.Meta.Columns.FindByPropertyName(name);
			if (col != null)
			{
				if(value == null || value is System.String)
				{				
					// Use the strongly typed property
					switch (name)
					{							
						case "LendID": this.str().LendID = (string)value; break;							
						case "Sn": this.str().Sn = (string)value; break;							
						case "LendType": this.str().LendType = (string)value; break;							
						case "LendDate": this.str().LendDate = (string)value; break;							
						case "Loanee": this.str().Loanee = (string)value; break;							
						case "ReturnDate": this.str().ReturnDate = (string)value; break;							
						case "LoaneeEmail": this.str().LoaneeEmail = (string)value; break;							
						case "ActReturnDate": this.str().ActReturnDate = (string)value; break;							
						case "Attachment": this.str().Attachment = (string)value; break;							
						case "Comments": this.str().Comments = (string)value; break;							
						case "CreatedBy": this.str().CreatedBy = (string)value; break;							
						case "CreatedDttm": this.str().CreatedDttm = (string)value; break;							
						case "UpdatedBy": this.str().UpdatedBy = (string)value; break;							
						case "UpdatedDttm": this.str().UpdatedDttm = (string)value; break;							
						case "LendStatus": this.str().LendStatus = (string)value; break;							
						case "LoaneePhone": this.str().LoaneePhone = (string)value; break;							
						case "Leader": this.str().Leader = (string)value; break;							
						case "LeaderEmail": this.str().LeaderEmail = (string)value; break;							
						case "ApplyDate": this.str().ApplyDate = (string)value; break;							
						case "ActLendDate": this.str().ActLendDate = (string)value; break;							
						case "IsKey": this.str().IsKey = (string)value; break;							
						case "KeyChecker": this.str().KeyChecker = (string)value; break;							
						case "KeyCeckDate": this.str().KeyCeckDate = (string)value; break;							
						case "Checker": this.str().Checker = (string)value; break;							
						case "CheckDate": this.str().CheckDate = (string)value; break;							
						case "FinChecker": this.str().FinChecker = (string)value; break;							
						case "FinCheckDate": this.str().FinCheckDate = (string)value; break;							
						case "CompanyName": this.str().CompanyName = (string)value; break;							
						case "ThirdUnitID": this.str().ThirdUnitID = (string)value; break;							
						case "LoaneeDepartment": this.str().LoaneeDepartment = (string)value; break;							
						case "ApplyDateEnd": this.str().ApplyDateEnd = (string)value; break;							
						case "PresentStartTime": this.str().PresentStartTime = (string)value; break;							
						case "PresentEndTime": this.str().PresentEndTime = (string)value; break;							
						case "Approver": this.str().Approver = (string)value; break;							
						case "ApproveEmail": this.str().ApproveEmail = (string)value; break;
					}
				}
				else
				{
					switch (name)
					{	
						case "LendID":
						
							if (value == null || value is System.Decimal)
								this.LendID = (System.Decimal?)value;
								OnPropertyChanged(FinLendMetadata.PropertyNames.LendID);
							break;
						
						case "LendDate":
						
							if (value == null || value is System.DateTime)
								this.LendDate = (System.DateTime?)value;
								OnPropertyChanged(FinLendMetadata.PropertyNames.LendDate);
							break;
						
						case "ReturnDate":
						
							if (value == null || value is System.DateTime)
								this.ReturnDate = (System.DateTime?)value;
								OnPropertyChanged(FinLendMetadata.PropertyNames.ReturnDate);
							break;
						
						case "ActReturnDate":
						
							if (value == null || value is System.DateTime)
								this.ActReturnDate = (System.DateTime?)value;
								OnPropertyChanged(FinLendMetadata.PropertyNames.ActReturnDate);
							break;
						
						case "CreatedDttm":
						
							if (value == null || value is System.DateTime)
								this.CreatedDttm = (System.DateTime?)value;
								OnPropertyChanged(FinLendMetadata.PropertyNames.CreatedDttm);
							break;
						
						case "UpdatedDttm":
						
							if (value == null || value is System.DateTime)
								this.UpdatedDttm = (System.DateTime?)value;
								OnPropertyChanged(FinLendMetadata.PropertyNames.UpdatedDttm);
							break;
						
						case "ApplyDate":
						
							if (value == null || value is System.DateTime)
								this.ApplyDate = (System.DateTime?)value;
								OnPropertyChanged(FinLendMetadata.PropertyNames.ApplyDate);
							break;
						
						case "ActLendDate":
						
							if (value == null || value is System.DateTime)
								this.ActLendDate = (System.DateTime?)value;
								OnPropertyChanged(FinLendMetadata.PropertyNames.ActLendDate);
							break;
						
						case "IsKey":
						
							if (value == null || value is System.Boolean)
								this.IsKey = (System.Boolean?)value;
								OnPropertyChanged(FinLendMetadata.PropertyNames.IsKey);
							break;
						
						case "KeyCeckDate":
						
							if (value == null || value is System.DateTime)
								this.KeyCeckDate = (System.DateTime?)value;
								OnPropertyChanged(FinLendMetadata.PropertyNames.KeyCeckDate);
							break;
						
						case "CheckDate":
						
							if (value == null || value is System.DateTime)
								this.CheckDate = (System.DateTime?)value;
								OnPropertyChanged(FinLendMetadata.PropertyNames.CheckDate);
							break;
						
						case "FinCheckDate":
						
							if (value == null || value is System.DateTime)
								this.FinCheckDate = (System.DateTime?)value;
								OnPropertyChanged(FinLendMetadata.PropertyNames.FinCheckDate);
							break;
						
						case "ThirdUnitID":
						
							if (value == null || value is System.Decimal)
								this.ThirdUnitID = (System.Decimal?)value;
								OnPropertyChanged(FinLendMetadata.PropertyNames.ThirdUnitID);
							break;
						
						case "ApplyDateEnd":
						
							if (value == null || value is System.DateTime)
								this.ApplyDateEnd = (System.DateTime?)value;
								OnPropertyChanged(FinLendMetadata.PropertyNames.ApplyDateEnd);
							break;
						
						case "PresentStartTime":
						
							if (value == null || value is System.DateTime)
								this.PresentStartTime = (System.DateTime?)value;
								OnPropertyChanged(FinLendMetadata.PropertyNames.PresentStartTime);
							break;
						
						case "PresentEndTime":
						
							if (value == null || value is System.DateTime)
								this.PresentEndTime = (System.DateTime?)value;
								OnPropertyChanged(FinLendMetadata.PropertyNames.PresentEndTime);
							break;
					

						default:
							break;
					}
				}
			}
            else if (this.ContainsColumn(name))
            {
                this.SetColumn(name, value);
            }
			else
			{
				throw new Exception("SetProperty Error: '" + name + "' not found");
			}
		}		

		public esStrings str()
		{
			if (esstrings == null)
			{
				esstrings = new esStrings(this);
			}
			return esstrings;
		}

		sealed public class esStrings
		{
			public esStrings(esFinLend entity)
			{
				this.entity = entity;
			}
			
	
			public System.String LendID
			{
				get
				{
					System.Decimal? data = entity.LendID;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.LendID = null;
					else entity.LendID = Convert.ToDecimal(value);
				}
			}
				
			public System.String Sn
			{
				get
				{
					System.String data = entity.Sn;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.Sn = null;
					else entity.Sn = Convert.ToString(value);
				}
			}
				
			public System.String LendType
			{
				get
				{
					System.String data = entity.LendType;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.LendType = null;
					else entity.LendType = Convert.ToString(value);
				}
			}
				
			public System.String LendDate
			{
				get
				{
					System.DateTime? data = entity.LendDate;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.LendDate = null;
					else entity.LendDate = Convert.ToDateTime(value);
				}
			}
				
			public System.String Loanee
			{
				get
				{
					System.String data = entity.Loanee;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.Loanee = null;
					else entity.Loanee = Convert.ToString(value);
				}
			}
				
			public System.String ReturnDate
			{
				get
				{
					System.DateTime? data = entity.ReturnDate;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ReturnDate = null;
					else entity.ReturnDate = Convert.ToDateTime(value);
				}
			}
				
			public System.String LoaneeEmail
			{
				get
				{
					System.String data = entity.LoaneeEmail;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.LoaneeEmail = null;
					else entity.LoaneeEmail = Convert.ToString(value);
				}
			}
				
			public System.String ActReturnDate
			{
				get
				{
					System.DateTime? data = entity.ActReturnDate;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ActReturnDate = null;
					else entity.ActReturnDate = Convert.ToDateTime(value);
				}
			}
				
			public System.String Attachment
			{
				get
				{
					System.String data = entity.Attachment;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.Attachment = null;
					else entity.Attachment = Convert.ToString(value);
				}
			}
				
			public System.String Comments
			{
				get
				{
					System.String data = entity.Comments;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.Comments = null;
					else entity.Comments = Convert.ToString(value);
				}
			}
				
			public System.String CreatedBy
			{
				get
				{
					System.String data = entity.CreatedBy;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.CreatedBy = null;
					else entity.CreatedBy = Convert.ToString(value);
				}
			}
				
			public System.String CreatedDttm
			{
				get
				{
					System.DateTime? data = entity.CreatedDttm;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.CreatedDttm = null;
					else entity.CreatedDttm = Convert.ToDateTime(value);
				}
			}
				
			public System.String UpdatedBy
			{
				get
				{
					System.String data = entity.UpdatedBy;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.UpdatedBy = null;
					else entity.UpdatedBy = Convert.ToString(value);
				}
			}
				
			public System.String UpdatedDttm
			{
				get
				{
					System.DateTime? data = entity.UpdatedDttm;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.UpdatedDttm = null;
					else entity.UpdatedDttm = Convert.ToDateTime(value);
				}
			}
				
			public System.String LendStatus
			{
				get
				{
					System.String data = entity.LendStatus;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.LendStatus = null;
					else entity.LendStatus = Convert.ToString(value);
				}
			}
				
			public System.String LoaneePhone
			{
				get
				{
					System.String data = entity.LoaneePhone;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.LoaneePhone = null;
					else entity.LoaneePhone = Convert.ToString(value);
				}
			}
				
			public System.String Leader
			{
				get
				{
					System.String data = entity.Leader;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.Leader = null;
					else entity.Leader = Convert.ToString(value);
				}
			}
				
			public System.String LeaderEmail
			{
				get
				{
					System.String data = entity.LeaderEmail;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.LeaderEmail = null;
					else entity.LeaderEmail = Convert.ToString(value);
				}
			}
				
			public System.String ApplyDate
			{
				get
				{
					System.DateTime? data = entity.ApplyDate;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ApplyDate = null;
					else entity.ApplyDate = Convert.ToDateTime(value);
				}
			}
				
			public System.String ActLendDate
			{
				get
				{
					System.DateTime? data = entity.ActLendDate;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ActLendDate = null;
					else entity.ActLendDate = Convert.ToDateTime(value);
				}
			}
				
			public System.String IsKey
			{
				get
				{
					System.Boolean? data = entity.IsKey;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.IsKey = null;
					else entity.IsKey = Convert.ToBoolean(value);
				}
			}
				
			public System.String KeyChecker
			{
				get
				{
					System.String data = entity.KeyChecker;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.KeyChecker = null;
					else entity.KeyChecker = Convert.ToString(value);
				}
			}
				
			public System.String KeyCeckDate
			{
				get
				{
					System.DateTime? data = entity.KeyCeckDate;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.KeyCeckDate = null;
					else entity.KeyCeckDate = Convert.ToDateTime(value);
				}
			}
				
			public System.String Checker
			{
				get
				{
					System.String data = entity.Checker;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.Checker = null;
					else entity.Checker = Convert.ToString(value);
				}
			}
				
			public System.String CheckDate
			{
				get
				{
					System.DateTime? data = entity.CheckDate;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.CheckDate = null;
					else entity.CheckDate = Convert.ToDateTime(value);
				}
			}
				
			public System.String FinChecker
			{
				get
				{
					System.String data = entity.FinChecker;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.FinChecker = null;
					else entity.FinChecker = Convert.ToString(value);
				}
			}
				
			public System.String FinCheckDate
			{
				get
				{
					System.DateTime? data = entity.FinCheckDate;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.FinCheckDate = null;
					else entity.FinCheckDate = Convert.ToDateTime(value);
				}
			}
				
			public System.String CompanyName
			{
				get
				{
					System.String data = entity.CompanyName;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.CompanyName = null;
					else entity.CompanyName = Convert.ToString(value);
				}
			}
				
			public System.String ThirdUnitID
			{
				get
				{
					System.Decimal? data = entity.ThirdUnitID;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ThirdUnitID = null;
					else entity.ThirdUnitID = Convert.ToDecimal(value);
				}
			}
				
			public System.String LoaneeDepartment
			{
				get
				{
					System.String data = entity.LoaneeDepartment;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.LoaneeDepartment = null;
					else entity.LoaneeDepartment = Convert.ToString(value);
				}
			}
				
			public System.String ApplyDateEnd
			{
				get
				{
					System.DateTime? data = entity.ApplyDateEnd;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ApplyDateEnd = null;
					else entity.ApplyDateEnd = Convert.ToDateTime(value);
				}
			}
				
			public System.String PresentStartTime
			{
				get
				{
					System.DateTime? data = entity.PresentStartTime;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.PresentStartTime = null;
					else entity.PresentStartTime = Convert.ToDateTime(value);
				}
			}
				
			public System.String PresentEndTime
			{
				get
				{
					System.DateTime? data = entity.PresentEndTime;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.PresentEndTime = null;
					else entity.PresentEndTime = Convert.ToDateTime(value);
				}
			}
				
			public System.String Approver
			{
				get
				{
					System.String data = entity.Approver;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.Approver = null;
					else entity.Approver = Convert.ToString(value);
				}
			}
				
			public System.String ApproveEmail
			{
				get
				{
					System.String data = entity.ApproveEmail;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ApproveEmail = null;
					else entity.ApproveEmail = Convert.ToString(value);
				}
			}
			

			private esFinLend entity;
		}
		
		[NonSerialized]
		private esStrings esstrings;		
		
		#endregion
		
		#region Housekeeping methods

		override protected IMetadata Meta
		{
			get
			{
				return FinLendMetadata.Meta();
			}
		}

		#endregion		
		
		#region Query Logic

		public FinLendQuery Query
		{
			get
			{
				if (this.query == null)
				{
					this.query = new FinLendQuery();
					InitQuery(this.query);
				}

				return this.query;
			}
		}

		public bool Load(FinLendQuery query)
		{
			this.query = query;
			InitQuery(this.query);
			return this.Query.Load();
		}
		
		protected void InitQuery(FinLendQuery query)
		{
			query.OnLoadDelegate = this.OnQueryLoaded;
			
			if (!query.es2.HasConnection)
			{
				query.es2.Connection = ((IEntity)this).Connection;
			}			
		}

		#endregion
		
        [IgnoreDataMember]
		private FinLendQuery query;		
	}



	[Serializable]
	abstract public partial class esFinLendCollection : esEntityCollection<FinLend>
	{
		#region Housekeeping methods
		override protected IMetadata Meta
		{
			get
			{
				return FinLendMetadata.Meta();
			}
		}

		protected override string GetCollectionName()
		{
			return "FinLendCollection";
		}

		#endregion		
		
		#region Query Logic

	#if (!WindowsCE)
		[BrowsableAttribute(false)]
	#endif
		public FinLendQuery Query
		{
			get
			{
				if (this.query == null)
				{
					this.query = new FinLendQuery();
					InitQuery(this.query);
				}

				return this.query;
			}
		}

		public bool Load(FinLendQuery query)
		{
			this.query = query;
			InitQuery(this.query);
			return Query.Load();
		}

		override protected esDynamicQuery GetDynamicQuery()
		{
			if (this.query == null)
			{
				this.query = new FinLendQuery();
				this.InitQuery(query);
			}
			return this.query;
		}

		protected void InitQuery(FinLendQuery query)
		{
			query.OnLoadDelegate = this.OnQueryLoaded;
			
			if (!query.es2.HasConnection)
			{
				query.es2.Connection = ((IEntityCollection)this).Connection;
			}			
		}

		protected override void HookupQuery(esDynamicQuery query)
		{
			this.InitQuery((FinLendQuery)query);
		}

		#endregion
		
		private FinLendQuery query;
	}



	[Serializable]
	abstract public partial class esFinLendQuery : esDynamicQuery
	{
		override protected IMetadata Meta
		{
			get
			{
				return FinLendMetadata.Meta();
			}
		}	
		
		#region QueryItemFromName
		
        protected override esQueryItem QueryItemFromName(string name)
        {
            switch (name)
            {
				case "LendID": return this.LendID;
				case "Sn": return this.Sn;
				case "LendType": return this.LendType;
				case "LendDate": return this.LendDate;
				case "Loanee": return this.Loanee;
				case "ReturnDate": return this.ReturnDate;
				case "LoaneeEmail": return this.LoaneeEmail;
				case "ActReturnDate": return this.ActReturnDate;
				case "Attachment": return this.Attachment;
				case "Comments": return this.Comments;
				case "CreatedBy": return this.CreatedBy;
				case "CreatedDttm": return this.CreatedDttm;
				case "UpdatedBy": return this.UpdatedBy;
				case "UpdatedDttm": return this.UpdatedDttm;
				case "LendStatus": return this.LendStatus;
				case "LoaneePhone": return this.LoaneePhone;
				case "Leader": return this.Leader;
				case "LeaderEmail": return this.LeaderEmail;
				case "ApplyDate": return this.ApplyDate;
				case "ActLendDate": return this.ActLendDate;
				case "IsKey": return this.IsKey;
				case "KeyChecker": return this.KeyChecker;
				case "KeyCeckDate": return this.KeyCeckDate;
				case "Checker": return this.Checker;
				case "CheckDate": return this.CheckDate;
				case "FinChecker": return this.FinChecker;
				case "FinCheckDate": return this.FinCheckDate;
				case "CompanyName": return this.CompanyName;
				case "ThirdUnitID": return this.ThirdUnitID;
				case "LoaneeDepartment": return this.LoaneeDepartment;
				case "ApplyDateEnd": return this.ApplyDateEnd;
				case "PresentStartTime": return this.PresentStartTime;
				case "PresentEndTime": return this.PresentEndTime;
				case "Approver": return this.Approver;
				case "ApproveEmail": return this.ApproveEmail;

                default: return null;
            }
        }		
		
		#endregion
		
		#region esQueryItems

		public esQueryItem LendID
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.LendID, esSystemType.Decimal); }
		} 
		
		public esQueryItem Sn
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.Sn, esSystemType.String); }
		} 
		
		public esQueryItem LendType
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.LendType, esSystemType.String); }
		} 
		
		public esQueryItem LendDate
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.LendDate, esSystemType.DateTime); }
		} 
		
		public esQueryItem Loanee
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.Loanee, esSystemType.String); }
		} 
		
		public esQueryItem ReturnDate
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.ReturnDate, esSystemType.DateTime); }
		} 
		
		public esQueryItem LoaneeEmail
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.LoaneeEmail, esSystemType.String); }
		} 
		
		public esQueryItem ActReturnDate
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.ActReturnDate, esSystemType.DateTime); }
		} 
		
		public esQueryItem Attachment
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.Attachment, esSystemType.String); }
		} 
		
		public esQueryItem Comments
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.Comments, esSystemType.String); }
		} 
		
		public esQueryItem CreatedBy
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.CreatedBy, esSystemType.String); }
		} 
		
		public esQueryItem CreatedDttm
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.CreatedDttm, esSystemType.DateTime); }
		} 
		
		public esQueryItem UpdatedBy
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.UpdatedBy, esSystemType.String); }
		} 
		
		public esQueryItem UpdatedDttm
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.UpdatedDttm, esSystemType.DateTime); }
		} 
		
		public esQueryItem LendStatus
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.LendStatus, esSystemType.String); }
		} 
		
		public esQueryItem LoaneePhone
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.LoaneePhone, esSystemType.String); }
		} 
		
		public esQueryItem Leader
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.Leader, esSystemType.String); }
		} 
		
		public esQueryItem LeaderEmail
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.LeaderEmail, esSystemType.String); }
		} 
		
		public esQueryItem ApplyDate
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.ApplyDate, esSystemType.DateTime); }
		} 
		
		public esQueryItem ActLendDate
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.ActLendDate, esSystemType.DateTime); }
		} 
		
		public esQueryItem IsKey
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.IsKey, esSystemType.Boolean); }
		} 
		
		public esQueryItem KeyChecker
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.KeyChecker, esSystemType.String); }
		} 
		
		public esQueryItem KeyCeckDate
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.KeyCeckDate, esSystemType.DateTime); }
		} 
		
		public esQueryItem Checker
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.Checker, esSystemType.String); }
		} 
		
		public esQueryItem CheckDate
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.CheckDate, esSystemType.DateTime); }
		} 
		
		public esQueryItem FinChecker
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.FinChecker, esSystemType.String); }
		} 
		
		public esQueryItem FinCheckDate
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.FinCheckDate, esSystemType.DateTime); }
		} 
		
		public esQueryItem CompanyName
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.CompanyName, esSystemType.String); }
		} 
		
		public esQueryItem ThirdUnitID
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.ThirdUnitID, esSystemType.Decimal); }
		} 
		
		public esQueryItem LoaneeDepartment
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.LoaneeDepartment, esSystemType.String); }
		} 
		
		public esQueryItem ApplyDateEnd
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.ApplyDateEnd, esSystemType.DateTime); }
		} 
		
		public esQueryItem PresentStartTime
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.PresentStartTime, esSystemType.DateTime); }
		} 
		
		public esQueryItem PresentEndTime
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.PresentEndTime, esSystemType.DateTime); }
		} 
		
		public esQueryItem Approver
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.Approver, esSystemType.String); }
		} 
		
		public esQueryItem ApproveEmail
		{
			get { return new esQueryItem(this, FinLendMetadata.ColumnNames.ApproveEmail, esSystemType.String); }
		} 
		
		#endregion
		
	}


	
	public partial class FinLend : esFinLend
	{

		
		
	}
	



	[Serializable]
	public partial class FinLendMetadata : esMetadata, IMetadata
	{
		#region Protected Constructor
		protected FinLendMetadata()
		{
			m_columns = new esColumnMetadataCollection();
			esColumnMetadata c;

			c = new esColumnMetadata(FinLendMetadata.ColumnNames.LendID, 0, typeof(System.Decimal), esSystemType.Decimal);
			c.PropertyName = FinLendMetadata.PropertyNames.LendID;
			c.IsInPrimaryKey = true;
			c.IsAutoIncrement = true;
			c.NumericPrecision = 18;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.Sn, 1, typeof(System.String), esSystemType.String);
			c.PropertyName = FinLendMetadata.PropertyNames.Sn;
			c.CharacterMaxLength = 50;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.LendType, 2, typeof(System.String), esSystemType.String);
			c.PropertyName = FinLendMetadata.PropertyNames.LendType;
			c.CharacterMaxLength = 50;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.LendDate, 3, typeof(System.DateTime), esSystemType.DateTime);
			c.PropertyName = FinLendMetadata.PropertyNames.LendDate;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.Loanee, 4, typeof(System.String), esSystemType.String);
			c.PropertyName = FinLendMetadata.PropertyNames.Loanee;
			c.CharacterMaxLength = 50;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.ReturnDate, 5, typeof(System.DateTime), esSystemType.DateTime);
			c.PropertyName = FinLendMetadata.PropertyNames.ReturnDate;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.LoaneeEmail, 6, typeof(System.String), esSystemType.String);
			c.PropertyName = FinLendMetadata.PropertyNames.LoaneeEmail;
			c.CharacterMaxLength = 100;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.ActReturnDate, 7, typeof(System.DateTime), esSystemType.DateTime);
			c.PropertyName = FinLendMetadata.PropertyNames.ActReturnDate;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.Attachment, 8, typeof(System.String), esSystemType.String);
			c.PropertyName = FinLendMetadata.PropertyNames.Attachment;
			c.CharacterMaxLength = 60;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.Comments, 9, typeof(System.String), esSystemType.String);
			c.PropertyName = FinLendMetadata.PropertyNames.Comments;
			c.CharacterMaxLength = 500;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.CreatedBy, 10, typeof(System.String), esSystemType.String);
			c.PropertyName = FinLendMetadata.PropertyNames.CreatedBy;
			c.CharacterMaxLength = 50;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.CreatedDttm, 11, typeof(System.DateTime), esSystemType.DateTime);
			c.PropertyName = FinLendMetadata.PropertyNames.CreatedDttm;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.UpdatedBy, 12, typeof(System.String), esSystemType.String);
			c.PropertyName = FinLendMetadata.PropertyNames.UpdatedBy;
			c.CharacterMaxLength = 50;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.UpdatedDttm, 13, typeof(System.DateTime), esSystemType.DateTime);
			c.PropertyName = FinLendMetadata.PropertyNames.UpdatedDttm;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.LendStatus, 14, typeof(System.String), esSystemType.String);
			c.PropertyName = FinLendMetadata.PropertyNames.LendStatus;
			c.CharacterMaxLength = 50;
			c.HasDefault = true;
			c.Default = @"((0))";
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.LoaneePhone, 15, typeof(System.String), esSystemType.String);
			c.PropertyName = FinLendMetadata.PropertyNames.LoaneePhone;
			c.CharacterMaxLength = 50;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.Leader, 16, typeof(System.String), esSystemType.String);
			c.PropertyName = FinLendMetadata.PropertyNames.Leader;
			c.CharacterMaxLength = 50;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.LeaderEmail, 17, typeof(System.String), esSystemType.String);
			c.PropertyName = FinLendMetadata.PropertyNames.LeaderEmail;
			c.CharacterMaxLength = 50;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.ApplyDate, 18, typeof(System.DateTime), esSystemType.DateTime);
			c.PropertyName = FinLendMetadata.PropertyNames.ApplyDate;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.ActLendDate, 19, typeof(System.DateTime), esSystemType.DateTime);
			c.PropertyName = FinLendMetadata.PropertyNames.ActLendDate;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.IsKey, 20, typeof(System.Boolean), esSystemType.Boolean);
			c.PropertyName = FinLendMetadata.PropertyNames.IsKey;
			c.HasDefault = true;
			c.Default = @"((0))";
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.KeyChecker, 21, typeof(System.String), esSystemType.String);
			c.PropertyName = FinLendMetadata.PropertyNames.KeyChecker;
			c.CharacterMaxLength = 50;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.KeyCeckDate, 22, typeof(System.DateTime), esSystemType.DateTime);
			c.PropertyName = FinLendMetadata.PropertyNames.KeyCeckDate;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.Checker, 23, typeof(System.String), esSystemType.String);
			c.PropertyName = FinLendMetadata.PropertyNames.Checker;
			c.CharacterMaxLength = 50;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.CheckDate, 24, typeof(System.DateTime), esSystemType.DateTime);
			c.PropertyName = FinLendMetadata.PropertyNames.CheckDate;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.FinChecker, 25, typeof(System.String), esSystemType.String);
			c.PropertyName = FinLendMetadata.PropertyNames.FinChecker;
			c.CharacterMaxLength = 50;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.FinCheckDate, 26, typeof(System.DateTime), esSystemType.DateTime);
			c.PropertyName = FinLendMetadata.PropertyNames.FinCheckDate;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.CompanyName, 27, typeof(System.String), esSystemType.String);
			c.PropertyName = FinLendMetadata.PropertyNames.CompanyName;
			c.CharacterMaxLength = 50;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.ThirdUnitID, 28, typeof(System.Decimal), esSystemType.Decimal);
			c.PropertyName = FinLendMetadata.PropertyNames.ThirdUnitID;
			c.NumericPrecision = 18;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.LoaneeDepartment, 29, typeof(System.String), esSystemType.String);
			c.PropertyName = FinLendMetadata.PropertyNames.LoaneeDepartment;
			c.CharacterMaxLength = 50;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.ApplyDateEnd, 30, typeof(System.DateTime), esSystemType.DateTime);
			c.PropertyName = FinLendMetadata.PropertyNames.ApplyDateEnd;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.PresentStartTime, 31, typeof(System.DateTime), esSystemType.DateTime);
			c.PropertyName = FinLendMetadata.PropertyNames.PresentStartTime;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.PresentEndTime, 32, typeof(System.DateTime), esSystemType.DateTime);
			c.PropertyName = FinLendMetadata.PropertyNames.PresentEndTime;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.Approver, 33, typeof(System.String), esSystemType.String);
			c.PropertyName = FinLendMetadata.PropertyNames.Approver;
			c.CharacterMaxLength = 50;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(FinLendMetadata.ColumnNames.ApproveEmail, 34, typeof(System.String), esSystemType.String);
			c.PropertyName = FinLendMetadata.PropertyNames.ApproveEmail;
			c.CharacterMaxLength = 50;
			c.IsNullable = true;
			m_columns.Add(c);
				
		}
		#endregion	
	
		static public FinLendMetadata Meta()
		{
			return meta;
		}	
		
		public Guid DataID
		{
			get { return base.m_dataID; }
		}	
		
		public bool MultiProviderMode
		{
			get { return false; }
		}		

		public esColumnMetadataCollection Columns
		{
			get	{ return base.m_columns; }
		}
		
		#region ColumnNames
		public class ColumnNames
		{ 
			 public const string LendID = "LendID";
			 public const string Sn = "SN";
			 public const string LendType = "LendType";
			 public const string LendDate = "LendDate";
			 public const string Loanee = "Loanee";
			 public const string ReturnDate = "ReturnDate";
			 public const string LoaneeEmail = "LoaneeEmail";
			 public const string ActReturnDate = "ActReturnDate";
			 public const string Attachment = "Attachment";
			 public const string Comments = "Comments";
			 public const string CreatedBy = "CreatedBy";
			 public const string CreatedDttm = "CreatedDttm";
			 public const string UpdatedBy = "UpdatedBy";
			 public const string UpdatedDttm = "UpdatedDttm";
			 public const string LendStatus = "LendStatus";
			 public const string LoaneePhone = "LoaneePhone";
			 public const string Leader = "Leader";
			 public const string LeaderEmail = "LeaderEmail";
			 public const string ApplyDate = "ApplyDate";
			 public const string ActLendDate = "ActLendDate";
			 public const string IsKey = "IsKey";
			 public const string KeyChecker = "KeyChecker";
			 public const string KeyCeckDate = "KeyCeckDate";
			 public const string Checker = "Checker";
			 public const string CheckDate = "CheckDate";
			 public const string FinChecker = "FinChecker";
			 public const string FinCheckDate = "FinCheckDate";
			 public const string CompanyName = "CompanyName";
			 public const string ThirdUnitID = "ThirdUnitID";
			 public const string LoaneeDepartment = "LoaneeDepartment";
			 public const string ApplyDateEnd = "ApplyDateEnd";
			 public const string PresentStartTime = "presentStartTime";
			 public const string PresentEndTime = "presentEndTime";
			 public const string Approver = "approver";
			 public const string ApproveEmail = "approveEmail";
		}
		#endregion	
		
		#region PropertyNames
		public class PropertyNames
		{ 
			 public const string LendID = "LendID";
			 public const string Sn = "Sn";
			 public const string LendType = "LendType";
			 public const string LendDate = "LendDate";
			 public const string Loanee = "Loanee";
			 public const string ReturnDate = "ReturnDate";
			 public const string LoaneeEmail = "LoaneeEmail";
			 public const string ActReturnDate = "ActReturnDate";
			 public const string Attachment = "Attachment";
			 public const string Comments = "Comments";
			 public const string CreatedBy = "CreatedBy";
			 public const string CreatedDttm = "CreatedDttm";
			 public const string UpdatedBy = "UpdatedBy";
			 public const string UpdatedDttm = "UpdatedDttm";
			 public const string LendStatus = "LendStatus";
			 public const string LoaneePhone = "LoaneePhone";
			 public const string Leader = "Leader";
			 public const string LeaderEmail = "LeaderEmail";
			 public const string ApplyDate = "ApplyDate";
			 public const string ActLendDate = "ActLendDate";
			 public const string IsKey = "IsKey";
			 public const string KeyChecker = "KeyChecker";
			 public const string KeyCeckDate = "KeyCeckDate";
			 public const string Checker = "Checker";
			 public const string CheckDate = "CheckDate";
			 public const string FinChecker = "FinChecker";
			 public const string FinCheckDate = "FinCheckDate";
			 public const string CompanyName = "CompanyName";
			 public const string ThirdUnitID = "ThirdUnitID";
			 public const string LoaneeDepartment = "LoaneeDepartment";
			 public const string ApplyDateEnd = "ApplyDateEnd";
			 public const string PresentStartTime = "PresentStartTime";
			 public const string PresentEndTime = "PresentEndTime";
			 public const string Approver = "Approver";
			 public const string ApproveEmail = "ApproveEmail";
		}
		#endregion	

		public esProviderSpecificMetadata GetProviderMetadata(string mapName)
		{
			MapToMeta mapMethod = mapDelegates[mapName];

			if (mapMethod != null)
				return mapMethod(mapName);
			else
				return null;
		}
		
		#region MAP esDefault
		
		static private int RegisterDelegateesDefault()
		{
			// This is only executed once per the life of the application
			lock (typeof(FinLendMetadata))
			{
				if(FinLendMetadata.mapDelegates == null)
				{
					FinLendMetadata.mapDelegates = new Dictionary<string,MapToMeta>();
				}
				
				if (FinLendMetadata.meta == null)
				{
					FinLendMetadata.meta = new FinLendMetadata();
				}
				
				MapToMeta mapMethod = new MapToMeta(meta.esDefault);
				mapDelegates.Add("esDefault", mapMethod);
				mapMethod("esDefault");
			}
			return 0;
		}			

		private esProviderSpecificMetadata esDefault(string mapName)
		{
			if(!m_providerMetadataMaps.ContainsKey(mapName))
			{
				esProviderSpecificMetadata meta = new esProviderSpecificMetadata();			


				meta.AddTypeMap("LendID", new esTypeMap("numeric", "System.Decimal"));
				meta.AddTypeMap("Sn", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("LendType", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("LendDate", new esTypeMap("datetime", "System.DateTime"));
				meta.AddTypeMap("Loanee", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("ReturnDate", new esTypeMap("datetime", "System.DateTime"));
				meta.AddTypeMap("LoaneeEmail", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("ActReturnDate", new esTypeMap("datetime", "System.DateTime"));
				meta.AddTypeMap("Attachment", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("Comments", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("CreatedBy", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("CreatedDttm", new esTypeMap("datetime", "System.DateTime"));
				meta.AddTypeMap("UpdatedBy", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("UpdatedDttm", new esTypeMap("datetime", "System.DateTime"));
				meta.AddTypeMap("LendStatus", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("LoaneePhone", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("Leader", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("LeaderEmail", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("ApplyDate", new esTypeMap("datetime", "System.DateTime"));
				meta.AddTypeMap("ActLendDate", new esTypeMap("datetime", "System.DateTime"));
				meta.AddTypeMap("IsKey", new esTypeMap("bit", "System.Boolean"));
				meta.AddTypeMap("KeyChecker", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("KeyCeckDate", new esTypeMap("datetime", "System.DateTime"));
				meta.AddTypeMap("Checker", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("CheckDate", new esTypeMap("datetime", "System.DateTime"));
				meta.AddTypeMap("FinChecker", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("FinCheckDate", new esTypeMap("datetime", "System.DateTime"));
				meta.AddTypeMap("CompanyName", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("ThirdUnitID", new esTypeMap("numeric", "System.Decimal"));
				meta.AddTypeMap("LoaneeDepartment", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("ApplyDateEnd", new esTypeMap("datetime", "System.DateTime"));
				meta.AddTypeMap("PresentStartTime", new esTypeMap("datetime", "System.DateTime"));
				meta.AddTypeMap("PresentEndTime", new esTypeMap("datetime", "System.DateTime"));
				meta.AddTypeMap("Approver", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("ApproveEmail", new esTypeMap("nvarchar", "System.String"));			
				
				
				
				meta.Source = "Fin_Lend";
				meta.Destination = "Fin_Lend";
				
				meta.spInsert = "proc_Fin_LendInsert";				
				meta.spUpdate = "proc_Fin_LendUpdate";		
				meta.spDelete = "proc_Fin_LendDelete";
				meta.spLoadAll = "proc_Fin_LendLoadAll";
				meta.spLoadByPrimaryKey = "proc_Fin_LendLoadByPrimaryKey";
				
				this.m_providerMetadataMaps["esDefault"] = meta;
			}
			
			return this.m_providerMetadataMaps["esDefault"];
		}

		#endregion

		static private FinLendMetadata meta;
		static protected Dictionary<string, MapToMeta> mapDelegates;
		static private int _esDefault = RegisterDelegateesDefault();
	}
}
